<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>C:\WorkingCopy\ColorTest\GetEnv.java.html</title>
<meta name="Generator" content="Vim/7.2">
<meta http-equiv="content-type" content="text/html; charset=Big5">
<style type="text/css">
<!--
.String { color: #00f080; background-color: #503040; }
.SpecialChar { color: #b0d0f0; background-color: #503040; }
.Repeat { color: #60d0d0; background-color: #503040; font-weight: bold; }
.Operator { color: #60d0d0; background-color: #503040; font-weight: bold; }
.StorageClass { color: #f070a0; background-color: #503040; font-weight: bold; }
.Comment { color: #c0c0c0; background-color: #503040; text-decoration: underline; }
.SpecialComment { color: #b0d0f0; background-color: #503040; }
.Special { color: #b0d0f0; background-color: #503040; }
.Function { color: #f0a070; background-color: #503040; }
.Type { color: #f070a0; background-color: #503040; font-weight: bold; }
pre { font-family: monospace; color: #f0f0f0; background-color: #503040; }
body { font-family: monospace; color: #f0f0f0; background-color: #503040; }
.Include { color: #f0f000; background-color: #503040; }
-->
</style>
</head>
<body>
<pre>
<span class="Include">import</span> java.util.Map;
<span class="Include">import</span> java.util.TreeSet;

<span class="StorageClass">public</span> <span class="StorageClass">class</span> GetEnv {
  <span class="Comment">/**</span>
<span class="Comment">   *</span><span class="SpecialComment"> let's test generics</span>
<span class="Comment">   </span><span class="Comment">* </span><span class="Special">@param</span><span class="Function"> args</span><span class="Comment"> the command line arguments</span>
<span class="Comment">   */</span>
  <span class="StorageClass">public</span> <span class="StorageClass">static</span> <span class="Type">void</span> main(String[] args) {
    <span class="Comment">// get a map of environment variables</span>
    Map&lt;String, String&gt; env = System.getenv();
    <span class="Comment">// build a sorted set out of the keys and iterate</span>
    <span class="Repeat">for</span>(String k: <span class="Operator">new</span> TreeSet&lt;String&gt;(env.keySet())) {
      System.out.printf(<span class="String">&quot;%s = %s</span><span class="SpecialChar">\n</span><span class="String">&quot;</span>, k, env.get(k));
    }
  }
}
</pre>
</body>
</html>
